/**
 * Created with IntelliJ IDEA.
 * Description:求1到100以内的素数
 * User: 15085202591
 * Date: 2022-10-30
 * Time: 23:41
 */
public class PrintPrime {
    public static void main(String[] args) {
        /**
         * 方法：循环遍历
         * 嵌套2层循环
         * 定义判断标志 flag
         */
        for (int i = 2; i <101 ; i++) {

            //标志
            boolean flag = true;

            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }

            if (flag) {
                System.out.print(i + " ");
            }
        }
        System.out.println("\n");
    }
}
